package com.che.software.testato.domain.entity;

import java.io.Serializable;

/**
 * Class representing a section.
 * 
 * @author Clement HELIOU (clement.heliou@che-software.com).
 * @copyright Che Software.
 * @license GNU General Public License.
 * @see Serializable
 * @since July, 2011.
 * 
 *        This file is part of Testato.
 * 
 *        Testato is free software: you can redistribute it and/or modify it
 *        under the terms of the GNU General Public License as published by the
 *        Free Software Foundation, either version 3 of the License, or (at your
 *        option) any later version.
 * 
 *        Testato is distributed in the hope that it will be useful, but WITHOUT
 *        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *        FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 *        for more details.
 * 
 *        You should have received a copy of the GNU General Public License
 *        along with Testato. If not, see <http://www.gnu.org/licenses/>.
 * 
 *        Testato's logo is a creation of Arrioch
 *        (http://arrioch.deviantart.com/) and it's distributed under the terms
 *        of the Creative Commons License.
 */
public class Section implements Serializable {

	/**
	 * Constants.
	 */
	private static final long serialVersionUID = -2402990565946089157L;

	/**
	 * Members.
	 */
	private boolean exclusive = false;
	private int maxIterationNumber = 0, sourceIntentionId, targetIntentionId;
	private String sourceIntention, strategyLabel, targetIntention;

	/**
	 * Getter for the private field value exclusive.
	 * 
	 * @return the exclusive field value.
	 */
	public boolean isExclusive() {
		return exclusive;
	}

	/**
	 * Setting a value to the exclusive field.
	 * 
	 * @param exclusive the value to set.
	 */
	public void setExclusive(boolean exclusive) {
		this.exclusive = exclusive;
	}

	/**
	 * Getter for the private field value maxIterationNumber.
	 * 
	 * @return the maxIterationNumber field value.
	 */
	public int getMaxIterationNumber() {
		return maxIterationNumber;
	}

	/**
	 * Setting a value to the maxIterationNumber field.
	 * 
	 * @param maxIterationNumber the value to set.
	 */
	public void setMaxIterationNumber(int maxIterationNumber) {
		this.maxIterationNumber = maxIterationNumber;
	}

	/**
	 * Getter for the private field value sourceIntentionId.
	 * 
	 * @return the sourceIntentionId field value.
	 */
	public int getSourceIntentionId() {
		return sourceIntentionId;
	}

	/**
	 * Setting a value to the sourceIntentionId field.
	 * 
	 * @param sourceIntentionId the value to set.
	 */
	public void setSourceIntentionId(int sourceIntentionId) {
		this.sourceIntentionId = sourceIntentionId;
	}

	/**
	 * Getter for the private field value targetIntentionId.
	 * 
	 * @return the targetIntentionId field value.
	 */
	public int getTargetIntentionId() {
		return targetIntentionId;
	}

	/**
	 * Setting a value to the targetIntentionId field.
	 * 
	 * @param targetIntentionId the value to set.
	 */
	public void setTargetIntentionId(int targetIntentionId) {
		this.targetIntentionId = targetIntentionId;
	}

	/**
	 * Getter for the private field value strategyLabel.
	 * 
	 * @return the strategyLabel field value.
	 */
	public String getStrategyLabel() {
		return strategyLabel;
	}

	/**
	 * Setting a value to the strategyLabel field.
	 * 
	 * @param strategyLabel the value to set.
	 */
	public void setStrategyLabel(String strategyLabel) {
		this.strategyLabel = strategyLabel;
	}

	/**
	 * Getter for the private field value sourceIntention.
	 * 
	 * @return the sourceIntention field value.
	 */
	public String getSourceIntention() {
		return sourceIntention;
	}

	/**
	 * Setting a value to the sourceIntention field.
	 * 
	 * @param sourceIntention the value to set.
	 */
	public void setSourceIntention(String sourceIntention) {
		this.sourceIntention = sourceIntention;
	}

	/**
	 * Getter for the private field value targetIntention.
	 * 
	 * @return the targetIntention field value.
	 */
	public String getTargetIntention() {
		return targetIntention;
	}

	/**
	 * Setting a value to the targetIntention field.
	 * 
	 * @param targetIntention the value to set.
	 */
	public void setTargetIntention(String targetIntention) {
		this.targetIntention = targetIntention;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (exclusive ? 1231 : 1237);
		result = prime * result + maxIterationNumber;
		result = prime * result + ((sourceIntention == null) ? 0 : sourceIntention.hashCode());
		result = prime * result + sourceIntentionId;
		result = prime * result + ((strategyLabel == null) ? 0 : strategyLabel.hashCode());
		result = prime * result + ((targetIntention == null) ? 0 : targetIntention.hashCode());
		result = prime * result + targetIntentionId;
		return result;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Section other = (Section) obj;
		if (exclusive != other.exclusive)
			return false;
		if (maxIterationNumber != other.maxIterationNumber)
			return false;
		if (sourceIntention == null) {
			if (other.sourceIntention != null)
				return false;
		} else if (!sourceIntention.equals(other.sourceIntention))
			return false;
		if (sourceIntentionId != other.sourceIntentionId)
			return false;
		if (strategyLabel == null) {
			if (other.strategyLabel != null)
				return false;
		} else if (!strategyLabel.equals(other.strategyLabel))
			return false;
		if (targetIntention == null) {
			if (other.targetIntention != null)
				return false;
		} else if (!targetIntention.equals(other.targetIntention))
			return false;
		if (targetIntentionId != other.targetIntentionId)
			return false;
		return true;
	}
}